<script>
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.dumpChildFrames();
        testRunner.waitUntilDone();
    }

    addEventListener("message", function() {
        // Call injected function.
        try {
            attack();
        } catch (e) {
            // V8 throws a TypeError: Cannot set property 'fail' of undefined.
        }

        // Post message to victim to check if it was accessed.
        window.frames['theFrame'].postMessage("test", "*");
    }, false);
</script>
<body>
    <p>Test cross-origin direct document access.</p>
    <iframe name="theFrame" src="resources/cross-frame-iframe-for-document-direct-test.html"></iframe>
</body>
</html>
